//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_animendswith.sqf"
#include "x_setup.sqf"

private ["_anim", "_ret", "_anim_ar", "_c", "_aselc"];
PARAMS_1(_anim);
if (_anim == "") exitWith {""};
_ret = "";
_anim_ar = toArray(toLower _anim);
_c = (count _anim_ar) - 1;
_aselc = _anim_ar select _c;
if (_aselc == 116) then { // t = left or right
	__DEC(_c);
	if (_anim_ar select _c == 102) then { // f
		if (_anim_ar select (_c - 1) == 101 && {_anim_ar select (_c - 2) == 108}) then { // e and l
			_ret = "left";
		};
	} else {
		if (_anim_ar select _c == 104) then { // h
			if (_anim_ar select (_c - 1) == 103 && {_anim_ar select (_c - 2) == 105} && {_anim_ar select (_c - 3) == 114}) then { // g, i and r
				_ret = "right";
			};
		};
	};
} else {
	if (_aselc == 112) then { // p
		if (_anim_ar select (_c - 1) == 117) then { // u
			_ret = "up";
		};
	} else {
		if (_aselc == 110) then { // n
			if (_anim_ar select (_c - 1) == 119 && {_anim_ar select (_c - 2) == 111} && {_anim_ar select (_c - 3) == 100}) then { // w, o and d
				_ret = "down";
			};
		};
	};
};
_ret